﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Fluent
{
    public static class BrowserExtension
    {
        public static TPage GetPage<TPage>(this Browser browser)
            where TPage : WebPageBase
        {
            Type pageType = typeof(TPage);
            ConstructorInfo constructor = pageType.GetConstructor(new[] { typeof(Browser) });
            TPage returnPage= (TPage)constructor.Invoke(new[] { browser });
            return returnPage;
        }
    }
}
